'use strict';

/**
 * 评论表种子数据
 */
module.exports = {
  up: async (queryInterface, Sequelize) => {
    // 先清空表中的数据
    await queryInterface.bulkDelete('comments', null, {});
    // 然后插入新数据
    await queryInterface.bulkInsert('comments', [
      {
        id: 1,
        content: '这个视频太棒了，学到了很多有用的信息！',
        like_count: 23,
        status: 1,
        user_id: 2, // demo_user
        video_id: 1,
        parent_id: null,
        created_at: new Date(),
        updated_at: new Date()
      },
      {
        id: 2,
        content: '请问有没有推荐的学习资源？',
        like_count: 8,
        status: 1,
        user_id: 1, // admin
        video_id: 1,
        parent_id: null,
        created_at: new Date(Date.now() - 3600000), // 1小时前
        updated_at: new Date(Date.now() - 3600000)
      },
      {
        id: 3,
        content: '感谢支持！后面会出更多优质内容。',
        like_count: 15,
        status: 1,
        user_id: 3, // content_creator
        video_id: 1,
        parent_id: 1,
        created_at: new Date(Date.now() - 7200000), // 2小时前
        updated_at: new Date(Date.now() - 7200000)
      },
      {
        id: 4,
        content: '教程讲解得很清晰，适合新手学习。',
        like_count: 34,
        status: 1,
        user_id: 2,
        video_id: 2,
        parent_id: null,
        created_at: new Date(),
        updated_at: new Date()
      },
      {
        id: 5,
        content: '游戏画面看起来很精美，值得一试。',
        like_count: 21,
        status: 1,
        user_id: 1,
        video_id: 3,
        parent_id: null,
        created_at: new Date(),
        updated_at: new Date()
      },
      {
        id: 6,
        content: 'AI技术的发展真是日新月异啊！',
        like_count: 45,
        status: 1,
        user_id: 2,
        video_id: 4,
        parent_id: null,
        created_at: new Date(Date.now() - 10800000), // 3小时前
        updated_at: new Date(Date.now() - 10800000)
      },
      {
        id: 7,
        content: '这个早餐食谱很实用，明天就试试！',
        like_count: 56,
        status: 1,
        user_id: 3,
        video_id: 5,
        parent_id: null,
        created_at: new Date(),
        updated_at: new Date()
      },
      {
        id: 8,
        content: '请问食材在哪里可以买到？',
        like_count: 12,
        status: 1,
        user_id: 1,
        video_id: 5,
        parent_id: 7,
        created_at: new Date(Date.now() - 14400000), // 4小时前
        updated_at: new Date(Date.now() - 14400000)
      }
    ], {});
  },

  down: async (queryInterface, Sequelize) => {
    await queryInterface.bulkDelete('comments', null, {});
  }
};